import {Provider} from "../base";
import {ethers} from 'ethers';
import Config from '@/assets/js/config/load';
const config = Config();

let abi = config.fomo.playerbookAbi;
let contractAddress = config.fomo.playerbookAddress;
let provider = Provider.ETSC;
let contract = new ethers.Contract(contractAddress, abi, provider);

/*
 * 根据地址获取用户详情
 */
export async function getPlayerInfoByAddress(addr) {
    return await contract.getPlayerInfoByAddress(addr);
}

export async function pIDxAddr_(addr) {
    return await contract.pIDxAddr_(addr);
}

export async function pIDxName_(name) {
    let pID = await contract.pIDxName_(name);
    return pID.toNumber();
}

export async function plyr_(pID) {
    return await contract.plyr_(pID);
}


